//
//  EVCPopWindowBtn.m
//  EverVCiOSClient
//
//  Created by 张可可 on 15/11/11.
//  Copyright (c) 2015年 EverVC. All rights reserved.
//

#import "EVCPopWindowBtn.h"

@interface EVCPopWindowBtn ()

@property (nonatomic, strong) UIColor *bgColor;

@end

@implementation EVCPopWindowBtn


+ (id)buttonWithType:(UIButtonType)buttonType title:(NSString *)title btnImage:(NSString *)btnImage titleColor:(UIColor *)titleColor bgColor:(UIColor *)bgColor {
    
    EVCPopWindowBtn *cancelBtn = [super buttonWithType:buttonType];
    cancelBtn.frame = CGRectMake(0, 0, ScreenSize.width, 45);
    [cancelBtn setTitle:title forState:UIControlStateNormal];
    [cancelBtn setTitleColor:titleColor forState:UIControlStateNormal];
    cancelBtn.titleLabel.font = [UIFont systemFontOfSize:15];
    
    cancelBtn.bgColor = bgColor;
    cancelBtn.backgroundColor = [UIColor whiteColor];
    
    if (btnImage) {
        [cancelBtn setImage:[UIImage imageNamed:btnImage] forState:UIControlStateNormal];
        cancelBtn.imageEdgeInsets = UIEdgeInsetsMake(0, 0, 0, 10);
    }
    
    return cancelBtn;
}

- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
    
    if (self.bgColor) {
        self.backgroundColor = self.bgColor;
    }
    
    [super touchesBegan:touches withEvent:event];
}

- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event {
    
    if (self.bgColor) {
        self.backgroundColor = [UIColor whiteColor];
    }
    
    [super touchesEnded:touches withEvent:event];
}


@end
